1. Field
Embodiments of the present invention generally relate to a method and apparatus for converting software. More specifically, certain embodiments of the present invention relate to a method and apparatus for converting assembly language software.
2. Description of the Related Art
Software written for programming computers, microprocessors, microcontrollers, and other hardware is often written in a low-level language known as assembly language. A program, or source code, written in assembly language includes a series of opcode mnemonics, when translated by an assembler, that correspond to a stream of executable instructions that can be loaded into a memory and executed. Assembly language implements a symbolic representation of numeric machine codes and other constants needed to program the hardware, and thus, is generally written in an architecture-specific manner defined by the hardware's manufacturer. For this reason, an assembly language is generally not easily portable from one manufacturer's device to another manufacturer's device.
Previous conversion tools were based on a literal translation mechanism which mapped each instruction in a first assembly language to a corresponding instruction in a second assembly language. Thus, the literal translation mechanism acts like a dictionary, providing a literal translation of each instruction from one language to another language. However, the literal translation mechanism does not take into consideration the context of each instruction. For example, to set a baud rate of a peripheral in source code written in a first assembly language may require three instructions, but, in a second assembly language, the same command to set the baud rate of the peripheral may require five instructions. If the three instructions from the first assembly language are merely literally translated, the resulting instructions in the second assembly language are insufficient to set the baud rate of the peripheral, as the fourth and fifth instruction in the second assembly language are missing. Thus, previous literal translation tools generally result in only about a 60%-70% accurate source code conversion rate.